package com.jianzh5.entity;

import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;
import java.util.HashSet;
import java.util.Set;

import static javax.persistence.GenerationType.IDENTITY;

/**
 * TCategory entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "t_category", catalog = "")
@DynamicInsert(true)
@DynamicUpdate(true)
public class TCategory implements java.io.Serializable {

	// Fields

	private Integer id;
	private String name;
	private String remark;
	private Integer seq;

	private Set<TProduct> TProducts = new HashSet<TProduct>(0);

	// Constructors

	/** default constructor */
	public TCategory() {
	}


	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}
	
	@Column(name = "name", length = 100)
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "remark", length = 100)
	public String getRemark() {
		return this.remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}
	
	@Column(name = "seq")
	public Integer getSeq() {
		return seq;
	}

	public void setSeq(Integer seq) {
		this.seq = seq;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "category")
	public Set<TProduct> getTProducts() {
		return TProducts;
	}

	public void setTProducts(Set<TProduct> TProducts) {
		this.TProducts = TProducts;
	}

	@Override public String toString() {
		return "TCategory{" +
				"id=" + id +
				", name='" + name + '\'' +
				", remark='" + remark + '\'' +
				", seq=" + seq +
				'}';
	}
}